import socket
import threading
import time
import _thread

def udp_server(s):
    while True:
        data, addr = s.recvfrom(1024)
        info = data.decode('utf-8')
        if info != 'o':
            friends = list(info)
            for f in friends:
                addr = tuple(f.split(':'))
                _thread.start_new_thread(udp_client,(s, addr, 'o', 1))
                s.sendto('o', addr)
        print(info, addr)

def udp_client(s=socket.socket(),addr=('10.30.243.191','8000'),info = 'first',t=10, count = 1000):
    while count > 0 :
        count -= 1
        s.sendto(info.encode(), addr)
        time.sleep(t)
